package uztest;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ui.tempdao.EgnFixedIncomeDao;
import ui.tempdao.EgnProductDao;
import dao.EgnFixedIncome;
import dao.EgnProduct;
import dao.EgnRstProductCf;
import dao.EgnRstProductRisk;
import dao.EgnRstProductVarmap;


public class TestEgnProduct {
	private final static Logger logger =
		LoggerFactory.getLogger(TestEgnProduct.class);

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
//		aaa();
//		bbb();
//		zzz();
//		ccc();
//		ddd();
//		eee();
//		fff();
		ggg();
//		xxx();
//		yyy();
	}
	
	private static void aaa(){
		List<EgnProduct> rst ;
		rst =EgnProductDao.getAllEgnProduct();

		for(EgnProduct aa: rst){
			logger.debug("Mv Type 1 :{},{}",aa.getProductId(), aa.getProductType());
		}
	}
	private static void xxx(){
		List<EgnProduct> rst ;
		rst =EgnProductDao.getAllEgnProduct(100);

		for(EgnProduct aa: rst){
			logger.debug("Mv Type 1 :{},{}",aa.getProductId(), aa.getProductType());
		}
	}
	private static void bbb(){
//		ScrollableResults rst ;
//		String prodType ="FixedIncomeInfo";
//		rst = EgnProductDao.getTypedEgnProduct(prodType);
//		while(rst.next()){
//			logger.debug("Test Scrolable:{}",rst.get(0).getClass().toString());
//		}
//		for(Object aa: rst.get()){
//			logger.debug("Mv Type 2 :{},{}",((EgnProduct)aa).getProductId(), ((EgnProduct)aa).getProductType());
//		}
		List<EgnProduct> rst ;
		String prodType ="FixedIncomeInfo";
		rst =EgnProductDao.getTypedEgnProduct(prodType);
		
		for(EgnProduct aa: rst){
			logger.debug("Mv Type 2 :{},{}",aa.getProductId(), aa.getProductType());
		}
	}
	private static void yyy(){
		List<EgnProduct> rst ;
		String prodType ="FixedIncomeInfo";
		rst =EgnProductDao.getTypedEgnProduct(prodType,100);
		
		for(EgnProduct aa: rst){
			logger.debug("Mv Type 2 :{},{}",aa.getProductId(), aa.getProductType());
		}
	}
	private static void zzz(){
		List<String> rst;
		rst = EgnProductDao.getEgnProductTypes();
		for(String aa: rst){
			logger.debug("Mv Type 2 :{},{}",aa);
		}
	}
	private static void ccc(){
		EgnProduct rst;
		String prodId = "PROD_100";
		rst = EgnProductDao.getEgnProduct(prodId);
		logger.debug("Mv Type 3 :{},{}",rst.getProductId(), rst.getProductType());
		
	}
	
	private static void ddd(){
		List<EgnRstProductCf> rst ;
		String prodId = "PROD_1";
		rst =EgnProductDao.getCashFlow(prodId);
		
		for(EgnRstProductCf aa: rst){
			logger.debug("Mv Type 2 :{},{}",aa.getId().getProductId(), aa.getCfDate());
		}
	}
	private static void eee(){
		List<EgnRstProductVarmap> rst ;
		String prodId = "PROD_1";
		rst =EgnProductDao.getVarmap(prodId);
		
		for(EgnRstProductVarmap aa: rst){
			logger.debug("Mv Type 3 :{},{}",aa.getId().getProductId(), aa.getVarMap());
		}
	
	}
	private static void fff(){
		List<EgnRstProductRisk> rst ;
		String prodId = "PROD_1";
		rst =EgnProductDao.getRisk(prodId);
		
		for(EgnRstProductRisk aa: rst){
			logger.debug("Mv Type 4 :{},{}",aa.getId().getProductId(), aa.getVaR());
		}
	}
	private static void ggg(){
		EgnFixedIncome rst;
		String prodId = "PROD_100";
		rst = EgnFixedIncomeDao.getEgnFixedIncome(prodId);
		logger.debug("Mv Type 3 :{},{}",rst.getAmortizationTerm(), rst.getAmortizationAmt());
	}
}
